package com.yan.hello;


import com.yan.hello.config.KnightConfig;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class App {

    public static void main(String[] args) {
        System.out.println("Hello World.");

        {
            ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("app-context.xml");
            Knight knight = context.getBean(Knight.class);
            knight.embarkOnQuest();
            context.close();
        }

        {
            AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(KnightConfig.class);
            Knight knight = (Knight) context.getBean("knight");
            knight.embarkOnQuest();
            context.close();

        }
    }

}
